home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / AIncludes / Slots.a < prev    next >
Encoding:
Text File  |  1993-11-30  |  13.1 KB  |  513 lines  |  [TEXT/MPS ]

  1. ;    File:        Slots.a
  2. ;
  3. ;    Copyright:    © 1983-1993 by Apple Computer, Inc.
  4. ;                All rights reserved.
  5. ;
  6. ;    Version:    System 7.1 for ETO #11
  7. ;    Created:    Tuesday, March 30, 1993 18:00
  8. ;
  9. ;___________________________________________________________________________
  10.  
  11.     IF &TYPE('__INCLUDINGSLOTS__') = 'UNDEFINED' THEN
  12. __INCLUDINGSLOTS__    SET    1
  13.  
  14. ; sInfo Array status flags (StatusFlags) in bit numbers
  15.  
  16. fDontUse          EQU         0                         ; old slotmgr put fcardIsChanged here
  17. fCardIsChanged    EQU         1                         ; card is Changed field in StatusFlags field of sInfoArray
  18. fTempEnabled      EQU         2                         ; slot is temporarily enabled
  19.  
  20. ; spBlock flags (spFlags)
  21.  
  22. fCkForNext        EQU         $00                       ; check for NEXT sRsrc in SRT            (SearchSRT)
  23. fCkReserved       EQU         $01                       ; check reserved field for zero         (ReadPBSize)
  24. fWarmStart        EQU         $02                       ; warm start, else cold start            (PrimaryInit)
  25. fClear            EQU         $03                       ; clear the memory                        (sNewPtr)
  26. fSys              EQU         $04                       ; alloc  on system heap                 (sNewPtr)
  27. fConsecBytes      EQU         $05                       ; calc step value for consecutive bytes (CalcStep)
  28.  
  29. ; flag bits for spParamData
  30.  
  31. fAll              EQU         0                         ; bit 0: set=search enabled/disabled sRsrc's
  32. fOneSlot          EQU         1                         ;      1: set=search sRsrc's in given slot only
  33. fNext             EQU         2                         ;      2: set=search for next sRsrc
  34.  
  35. ; sResource flags (sRsrc_Flags) - flags 8-15 are entered into srt flags field
  36.  
  37. fOpenAtStart      EQU         1                         ; open the driver at start time, else do not
  38. f32BitMode        EQU         2                         ; a 32-bit address will be put into dctlDevBase
  39.  
  40. ; state constants for sInfoRecord
  41.  
  42. stateNil          EQU         0                         ; uninitialized sInfoRecord
  43. stateSDMInit      EQU         1                         ; sInfoRecord initialized - executed InitSDeclMgr
  44. statePRAMInit     EQU         2                         ; sPRAM record initialized - executed InitSPRAMRec
  45. statePInit        EQU         3                         ; primary Init executed
  46. stateSInit        EQU         4                         ; secondary init executed
  47.  
  48. ;Misc masks <6>
  49.  
  50. catMask            EQU            $08                        ; sets spCategory field of spTBMask (bit 3)
  51. cTypeMask        EQU            $04                        ; sets spCType    field of spTBMask (bit 2)
  52. drvrSWMask        EQU            $02                        ; sets spDrvrSW   field of spTBMask (bit 1)
  53. drvrHWMask        EQU            $01                        ; sets spDrvrHW      field of spTBMask (bit 0)
  54.  
  55. ;Misc constants
  56.  
  57. sizeSPRAMRec      EQU         8                         ; size of sPRAM record
  58. smPRAMTop         EQU         $46                       ; address of beginning of slot PRAM area
  59. majorSpace        EQU         $90                       ; high byte of beginning of major space
  60.  
  61. TotalSlots        EQU         15                        ; number of slot supported
  62. minorLast         EQU         $FEFFFFFF                 ; last minor slot addr
  63. FirstPRAMSlot     EQU         $9                        ; First slot with PRAM allocated
  64. sNumSlots         EQU         6                         ; used for number of slot interrupts supported on via
  65. sFirstSlot        EQU         $9                        ; First slot supported
  66. sLastSlot         EQU         $E                        ; The last slot.
  67. minorStep         EQU         $01000000                 ; value to step minor address to next slot
  68. retryCnt          EQU         100                       ; default retry cnt on a Nubus read bus error
  69.  
  70. lastSDMSelt       EQU         $3D                       ;The last SDM selector
  71.  
  72. ;
  73. ;    Slot interrupt queue element  -  Used to install a slot interrupt handler by sInitInstall
  74. ;
  75.  
  76. SlotIntQElement   RECORD      0
  77. sqLink            DS.L        1                         ; Ptr - ptr to next element
  78. sqType            DS.W        1                         ; INTEGER - queue type ID for validity
  79. sqPrio            DS.W        1                         ; INTEGER - priority
  80. sqAddr            DS.L        1                         ; ProcPtr - interrupt service routine
  81. sqParm            DS.L        1                         ; LONGINT - optional A1 parameter
  82. sqHDSize          EQU         *                         ; size of slot queue header element
  83.                   ENDR
  84.  
  85. ;
  86. ;    Slot Parameter Block  -  parameter block to all slot manager routines.    All fields
  87. ;    may be inputs, or outputs.
  88. ;
  89.  
  90. SpBlock           RECORD      0
  91. spResult          DS.L        1                         ; result
  92. spSPointer        DS.L        1                         ; general pointer
  93. spSize            DS.L        1                         ; size
  94. spOffsetData      DS.L        1                         ; Offset/Data field value            (sOffsetData)
  95. spIOFileName      DS.L        1                         ; Pointer to IOFile name            (not used)
  96. spSExecPBlk       DS.L        1                         ; Pointer to sExec block
  97. spParamData       DS.L        1                         ; misc parameter data                (formerly spStackPtr)
  98. spMisc            DS.L        1                         ; Misc field for SDM                (not used)
  99. spReserved        DS.L        1                         ; Reserved for future expansion
  100. spIOReserved      DS.W        1                         ; Reserved field of SRT
  101. spRefNum          DS.W        1                         ; RefNum
  102. spCategory        DS.W        1                         ; sResource category
  103. spCType           DS.W        1                         ;            type
  104. spDrvrSW          DS.W        1                         ;            drvrsw
  105. spDrvrHW          DS.W        1                         ;            drvrhw
  106. spTBMask          DS.B        1                         ; type bit mask (bit 0 set = ignore drvrhw, bit 1 = drvrsw, ...)
  107. spSlot            DS.B        1                         ; slot number.
  108. spId              DS.B        1                         ; sResource id
  109. spExtDev          DS.B        1                         ; external device id
  110. spHwDev           DS.B        1                         ; hardware device id
  111. spByteLanes       DS.B        1                         ; bytelanes value from FHeader in the declaration ROM.
  112. spFlags           DS.B        1                         ; general flags
  113. spKey             DS.B        1                         ; reserved                            (not used)
  114. spBlockSize       EQU         *                         ; Size of spBlock
  115.                   ENDR
  116.  
  117. ;
  118. ;    sInfo Record  -  general slot information.    A record exists for each slot
  119.  
  120.  
  121. SInfoRecord       RECORD      0                         ;Slot information record. sInfo Array[1..NumSlots]
  122. siDirPtr          DS.L        1                         ; Pointer to directory
  123. siInitStatusA     DS.W        1                         ; Fundamental Error
  124. siInitStatusV     DS.W        1                         ; Status returned by vendor Init code
  125. siState           DS.B        1                         ; Initialization State (Primary, Secondary)
  126. siCPUByteLanes    DS.B        1                         ; CPU Byte Lanes. Each bit set signifies a byte-lane used.
  127. siTopOfROM        DS.B        1                         ; Top of ROM = $FssFFFFx, where x is TopOfROM.
  128. siStatusFlags     DS.B        1                         ; Bit-0:Card is changed
  129. siTOConst         DS.W        1                         ; Time Out Constant for BusErr
  130. siReserved        DS.B        2                         ; Reserved, must be 0
  131. sInfoRecSize      EQU         *                         ; Size of sInfoRecord
  132. siROMAddr         DS.L        1                         ; Address of top of ROM (major or minor space)
  133. siSlot            DS.B        1                         ; slot number
  134. siPadding         DS.B        3                         ; padding to bring out to next long
  135. sInfoNewSize      EQU         *                         ; size of new sInfo record
  136.                   ENDR
  137.  
  138. FHeaderRec        RECORD      0
  139. fhDirOffset       DS.L        1                         ;Offset to directory
  140. fhLength          DS.L        1                         ;Length of ROM
  141. fhCRC             DS.L        1                         ;CRC
  142. fhROMRev          DS.B        1                         ;Revision of ROM
  143. fhFormat          DS.B        1                         ;Format-2
  144. fhTstPat          DS.L        1                         ;TestPattern
  145. fhReserved        DS.B        1                         ;Reserved
  146. fhByteLanes       DS.B        1                         ;ByteLanes
  147. fhBlockSize       EQU         *
  148.                   ENDR
  149.  
  150. OffsetToDir       EQU         FHeaderRec.fhDirOffset-FHeaderRec.fhBlockSize+1
  151.                                                         ; offset to dir ptr
  152.  
  153. SEBlock           RECORD      0                         ;Parameter block for code executed by sExec.
  154. ;------- elements of all seBlocks ------
  155. seSlot            DS.B        1                         ; Slot number.
  156. seSRsrcId         DS.B        1                         ; sResource Id.
  157. seStatus          DS.W        1                         ; Status of code executed by sExec.
  158. seFlags           DS.B        1                         ; Flags.
  159. seFiller          DS.B        3                         ; Filler
  160. ;------- extensions for sLoad + sBoot ------
  161. seResult          DS.L        1                         ; Result of sLoad.
  162. seIOFileName      DS.L        1                         ; Pointer to IOFile name.
  163. seDevice          DS.B        1                         ; Which device to read from.
  164. sePartition       DS.B        1                         ; The partition.
  165. seOSType          DS.B        1                         ; Type of OS.
  166. seReserved        DS.B        1                         ; Reserved field.
  167. seRefNum          DS.B        1                         ; RefNum of the driver.
  168. ;------- extensions for sBoot ------
  169. seNumDevices      DS.B        1                         ; Number of devices to load.
  170. seBootState       DS.B        1                         ; State of StartBoot code.
  171.                   ALIGN       2
  172. seBlockSize       EQU         *                         ; Size of se parameter Block
  173.                   ENDR
  174.  
  175. ; Slot Manager Selectors:
  176. ;
  177. ; PRINCIPLE
  178.  
  179. sReadByte         EQU         $00
  180. sReadWord         EQU         $01
  181. sReadLong         EQU         $02
  182. sGetCString       EQU         $03
  183. sGetBlock         EQU         $05
  184. sFindStruct       EQU         $06
  185. sReadStruct       EQU         $07
  186. sVersion          EQU         $08
  187. sSetSRsrcState    EQU         $09
  188. sInsertSRTRec     EQU         $0A
  189. sGetSRsrc         EQU         $0B
  190. sGetTypeSRsrc     EQU         $0C
  191.  
  192. ; SPECIAL
  193. sReadInfo         EQU         $10
  194. sReadPRAMRec      EQU         $11
  195. sPutPRAMRec       EQU         $12
  196. sReadFHeader      EQU         $13
  197. sNextSRsrc        EQU         $14
  198. sNextTypeSRsrc    EQU         $15
  199. sRsrcInfo         EQU         $16
  200. sDisposePtr       EQU         $17
  201. sCkCardStat       EQU         $18
  202. sReadDrvrName     EQU         $19
  203. sFindSRTRec       EQU         $1A
  204. sFindDevBase      EQU         $1B
  205. sFindBigDevBase    EQU         $1C
  206. sGetSRsrcPtr      EQU         $1D
  207.  
  208. ; Advanced
  209. initSDeclMgr      EQU         $20
  210. sPrimaryInit      EQU         $21
  211. sCardChanged      EQU         $22
  212. sExec             EQU         $23
  213. sOffsetData       EQU         $24
  214. sInitPRAMRecs     EQU         $25
  215. sReadPBSize       EQU         $26
  216.  
  217. sCalcStep         EQU         $28
  218. sInitSRsrcTable    EQU         $29
  219. sSearchSRT        EQU         $2A
  220. sUpdateSRT        EQU         $2B
  221. sCalcSPointer     EQU         $2C
  222. sGetDriver        EQU         $2D
  223. sPtrToSlot        EQU         $2E
  224. sFindSInfoRecPtr EQU         $2F
  225. sFindSRsrcPtr     EQU         $30
  226. sDeleteSRTRec     EQU         $31
  227. sSecondaryInit    EQU         $32
  228. sInitSlotPRAM     EQU         $33
  229.  
  230.  
  231. ;#####################################################################
  232. ; PRINCIPLE
  233. ;#####################################################################
  234.  
  235.                   MACRO
  236.                   _SReadByte
  237.                   MOVEQ       #sReadByte,D0
  238.                   _SlotManager
  239.                   ENDM
  240.  
  241.                   MACRO
  242.                   _SReadWord
  243.                   MOVEQ       #sReadWord,D0
  244.                   _SlotManager
  245.                   ENDM
  246.  
  247.                   MACRO
  248.                   _SReadLong
  249.                   MOVEQ       #sReadLong,D0
  250.                   _SlotManager
  251.                   ENDM
  252.  
  253.                   MACRO
  254.                   _SGetCString
  255.                   MOVEQ       #sGetCString,D0
  256.                   _SlotManager
  257.                   ENDM
  258.  
  259.                   MACRO
  260.                   _SGetBlock
  261.                   MOVEQ       #sGetBlock,D0
  262.                   _SlotManager
  263.                   ENDM
  264.  
  265.                   MACRO
  266.                   _SFindStruct
  267.                   MOVEQ       #sFindStruct,D0
  268.                   _SlotManager
  269.                   ENDM
  270.  
  271.                   MACRO
  272.                   _SReadStruct
  273.                   MOVEQ       #sReadStruct,D0
  274.                   _SlotManager
  275.                   ENDM
  276.  
  277.                   MACRO
  278.                   _SVersion
  279.                   MOVEQ       #sVersion,D0
  280.                   _SlotManager
  281.                   ENDM
  282.  
  283.                   MACRO
  284.                   _SetSRsrcState
  285.                   MOVEQ       #sSetSRsrcState,D0
  286.                   _SlotManager
  287.                   ENDM
  288.  
  289.                   MACRO
  290.                   _InsertSRTRec
  291.                   MOVEQ       #sInsertSRTRec,D0
  292.                   _SlotManager
  293.                   ENDM
  294.  
  295.                   MACRO
  296.                   _GetSRsrc
  297.                   MOVEQ       #sGetSRsrc,D0
  298.                   _SlotManager
  299.                   ENDM
  300.  
  301.                   MACRO
  302.                   _GetTypeSRsrc
  303.                   MOVEQ       #sGetTypeSRsrc,D0
  304.                   _SlotManager
  305.                   ENDM
  306.  
  307.  
  308. ;#####################################################################
  309. ; SPECIAL
  310. ;#####################################################################
  311.                   MACRO
  312.                   _SReadInfo
  313.                   MOVEQ       #sReadInfo,D0
  314.                   _SlotManager
  315.                   ENDM
  316.  
  317.                   MACRO
  318.                   _SReadPRAMRec
  319.                   MOVEQ       #sReadPRAMRec,D0
  320.                   _SlotManager
  321.                   ENDM
  322.  
  323.                   MACRO
  324.                   _SPutPRAMRec
  325.                   MOVEQ       #sPutPRAMRec,D0
  326.                   _SlotManager
  327.                   ENDM
  328.  
  329.                   MACRO
  330.                   _SReadFHeader
  331.                   MOVEQ       #sReadFHeader,D0
  332.                   _SlotManager
  333.                   ENDM
  334.  
  335.                   MACRO
  336.                   _SNextSRsrc
  337.                   MOVEQ       #sNextSRsrc,D0
  338.                   _SlotManager
  339.                   ENDM
  340.  
  341.                   MACRO
  342.                   _SNextTypeSRsrc
  343.                   MOVEQ       #sNextTypeSRsrc,D0
  344.                   _SlotManager
  345.                   ENDM
  346.  
  347.                   MACRO
  348.                   _SRsrcInfo
  349.                   MOVEQ       #sRsrcInfo,D0
  350.                   _SlotManager
  351.                   ENDM
  352.  
  353.                   MACRO
  354.                   _SDisposePtr
  355.                   MOVEQ       #sDisposePtr,D0
  356.                   _SlotManager
  357.                   ENDM
  358.  
  359.                   MACRO
  360.                   _SCkCardStat
  361.                   MOVEQ       #sCkCardStat,D0
  362.                   _SlotManager
  363.                   ENDM
  364.  
  365.                   MACRO
  366.                   _SReadDrvrName
  367.                   MOVEQ       #sReadDrvrName,D0
  368.                   _SlotManager
  369.                   ENDM
  370.  
  371.                   MACRO
  372.                   _FindSRTRec
  373.                   MOVEQ       #sFindSRTRec,D0
  374.                   _SlotManager
  375.                   ENDM
  376.  
  377.                   MACRO
  378.                   _SFindDevBase
  379.                   MOVEQ       #sFindDevBase,D0
  380.                   _SlotManager
  381.                   ENDM
  382.  
  383.                   MACRO
  384.                   _SFindBigDevBase
  385.                   MOVEQ       #sFindBigDevBase,D0
  386.                   _SlotManager
  387.                   ENDM
  388.  
  389.                   MACRO
  390.                   _GetSRsrcPtr
  391.                   MOVEQ       #sGetSRsrcPtr,D0
  392.                   _SlotManager
  393.                   ENDM
  394.  
  395. ;#####################################################################
  396. ; Advanced
  397. ;#####################################################################
  398.                   MACRO
  399.                   _InitSDeclMgr
  400.                   MOVEQ       #initSDeclMgr,D0
  401.                   _SlotManager
  402.                   ENDM
  403.  
  404.                   MACRO
  405.                   _SPrimaryInit
  406.                   MOVEQ       #sPrimaryInit,D0
  407.                   _SlotManager
  408.                   ENDM
  409.  
  410.                   MACRO
  411.                   _SCardChanged
  412.                   MOVEQ       #sCardChanged,D0
  413.                   _SlotManager
  414.                   ENDM
  415.  
  416.                   MACRO
  417.                   _SExec
  418.                   MOVEQ       #sExec,D0
  419.                   _SlotManager
  420.                   ENDM
  421.  
  422.                   MACRO
  423.                   _SOffsetData
  424.                   MOVEQ       #sOffsetData,D0
  425.                   _SlotManager
  426.                   ENDM
  427.  
  428.                   MACRO
  429.                   _SInitPRAMRecs
  430.                   MOVEQ       #sInitPRAMRecs,D0
  431.                   _SlotManager
  432.                   ENDM
  433.  
  434.                   MACRO
  435.                   _SReadPBSize
  436.                   MOVEQ       #sReadPBSize,D0
  437.                   _SlotManager
  438.                   ENDM
  439.  
  440.                   MACRO
  441.                   _SCalcStep
  442.                   MOVEQ       #sCalcStep,D0
  443.                   _SlotManager
  444.                   ENDM
  445.  
  446.                   MACRO
  447.                   _SInitSRsrcTable
  448.                   MOVEQ       #sInitSRsrcTable,D0
  449.                   _SlotManager
  450.                   ENDM
  451.  
  452.                   MACRO
  453.                   _SSearchSRT
  454.                   MOVEQ       #sSearchSRT,D0
  455.                   _SlotManager
  456.                   ENDM
  457.  
  458.                   MACRO
  459.                   _SUpdateSRT
  460.                   MOVEQ       #sUpdateSRT,D0
  461.                   _SlotManager
  462.                   ENDM
  463.  
  464.                   MACRO
  465.                   _SCalcSPointer
  466.                   MOVEQ       #sCalcSPointer,D0
  467.                   _SlotManager
  468.                   ENDM
  469.  
  470.                   MACRO
  471.                   _SGetDriver
  472.                   MOVEQ       #sGetDriver,D0
  473.                   _SlotManager
  474.                   ENDM
  475.  
  476.                   MACRO
  477.                   _SPtrToSlot
  478.                   MOVEQ       #sPtrToSlot,D0
  479.                   _SlotManager
  480.                   ENDM
  481.  
  482.                   MACRO
  483.                   _SFindSInfoRecPtr
  484.                   MOVEQ       #sFindSInfoRecPtr,D0
  485.                   _SlotManager
  486.                   ENDM
  487.  
  488.                   MACRO
  489.                   _SFindSRsrcPtr
  490.                   MOVEQ       #sFindSRsrcPtr,D0
  491.                   _SlotManager
  492.                   ENDM
  493.  
  494.                   MACRO
  495.                   _SDeleteSRTRec
  496.                   MOVEQ       #sDeleteSRTRec,D0
  497.                   _SlotManager
  498.                   ENDM
  499.  
  500.                   MACRO
  501.                   _SecondaryInit
  502.                   MOVEQ       #sSecondaryInit,D0
  503.                   _SlotManager
  504.                   ENDM
  505.  
  506.                   MACRO
  507.                   _InitSlotPRAM
  508.                   MOVEQ       #sInitSlotPRAM,D0
  509.                   _SlotManager
  510.                   ENDM
  511.  
  512.     ENDIF    ; ...already included
  513.